import { mock, type MockjsRequestOptions } from "mockjs";

export const homeStatisticMock = () => {
  mock(/.*?\/api\/home\/statistic/, (options: MockjsRequestOptions) => {
    console.log(options, "options");
    return mock({
      code: 0,
      message: "",
      data: [
        {
          label: "在线总数",
          value: 100,
        },
        {
          label: "用户总数",
          value: 200,
        },
        {
          label: "文章总数",
          value: 300,
        },
        {
          label: "消息总数",
          value: 400,
        },
        {
          label: "登录总数",
          value: 500,
        },
      ],
    });
  });
};
export const homeLoginStatisticMock = () => {
  mock(/.*?\/api\/home\/login_statistic/, (options: MockjsRequestOptions) => {
    console.log(options, "options");
    return mock({
      code: 0,
      message: "",
      data: {
        data: [
          "2024-02-01",
          "2024-02-02",
          "2024-02-03",
          "2024-02-04",
          "2024-02-05",
          "2024-02-06",
          "2024-02-07",
        ],
        loginData: [110, 120, 90, 100, 100, 90, 70],
        registerData: [100, 100, 90, 150, 130, 120, 100],
      },
    });
  });
};
export const homeVersionMock = () => {
  mock(/.*?\/api\/home\/version/, (options: MockjsRequestOptions) => {
    console.log(options, "options");
    return mock({
      code: 0,
      message: "",
      data: [
        {
          title: "日志1",
          time: "2024-12-15 09:16:58.351",
          items: [
            {
              code: 1,
              desc: "1.0.0版本上线",
            },
            {
              code: 2,
              desc: "2.0.0版本上线",
            },
            {
              code: 3,
              desc: "3.0.0版本上线",
            },
          ],
        },
        {
          title: "日志2",
          time: "2024-10-25 09:16:58.351",
          items: [
            {
              code: 1,
              desc: "1.0.0版本上线",
            },
          ],
        },
        {
          title: "日志3",
          time: "2023-12-25 09:16:58.351",
        },
        {
          title: "日志4",
          time: "2023-12-25 09:16:58.351",
        },
      ],
    });
  });
};
